Java Testing with Selenium by Sujay Raghavendra

Java Testing with Selenium by Sujay Raghavendra

Author:Sujay Raghavendra
Language: eng
Format: epub
ISBN: 9798868802911
Publisher: Apress


Selecting and Deselecting Options with MultiSelectList

A MultiSelectList element lets you select and deselect multiple options. Let’s discuss how to interact with them using Selenium.

Selecting Multiple Options

The Select class interacts with a SelectList element and selects multiple options by visible text, value, or index.Select languagesSelectList = new Select(driver.findElement(By.id("languages")));

languagesSelectList.selectByVisibleText("Java");

languagesSelectList.selectByValue("python");

languagesSelectList.selectByIndex(2); // 0-based index, selects "JavaScript"



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.